<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css" media="all" />
    <style>
        .nav {
            list-style-type: none;
            display: flex;
        }

        .tabs-process {
            position: absolute;
            left: 50px;
            top: 50px;
            width: 200px;
            height: 500px;
        }

        ul {
            margin-left: 5%;
        }

        ul {
            position: relative;
            padding: 0;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }

        ul li {
            list-style: none;
            display: inline-block;
            width: 130px;
            height: 60px;
            background: #DA4453;
            font-size: 16px;
            text-align: center;
            line-height: 60px;
            color: #fff;
            text-transform: uppercase;
            position: relative;
            overflow: hidden;
            cursor: pointer;
            margin-right: 2px;
        }

        /*.tabs-title{width: 100px;height: 50px;argin-left: 40px}*/
        .tabs-process {
            width: 100%;
            margin-top: 5%
        }

        .active {
            background-color: #46cf51;
        }
    </style>
</head>

<body style="max-height: 750px; height:auto; display: flex;flex-direction: column;justify-content: center">
    <div class="layui-form">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label" style="width: 150px">历史数据信息</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="test1" placeholder="请选择要查看的日期" readonly>
                </div>
            </div>
        </div>
    </div>
    <div id="main1" style="width:100%; height: 650px; text-align: center;"></div>
</body>

<script src="/static/home/js/echarts-min.js"></script>
<script src="/static/home/js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="/static/plugins/layui/layui.js"></script>

<script>
    layui.use('laydate', function () {
        var laydate = layui.laydate, $ = layui.$;
        var myChart = echarts.init(document.getElementById('main1'),'light');

        let opts = {$opt| raw};
        console.log(opts);

        myChart.setOption(opts);
        //常规用法
        laydate.render({
            elem: '#test1', 
            // 请求历史数据 
            done: function (value, date, endDate) {
                console.log(value); //得到日期生成的值，如：2017-08-18
                
                $.post("{:url('history')}",{select:value},function(res){
                    if(res['opt'].length > 0){
                        myChart.setOption(res['opt']);
                    }
                })
                console.log(date); //得到日期时间对象：{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
                console.log(endDate); //得结束的日期时间对象，开启范围选择（range: true）才会返回。对象成员同上。
            }
        });
    });
    


</script>

</html>